package com.feng.annotation.concurrent;

import java.util.Hashtable;
import java.util.Map;
import java.util.UUID;

/**
 * @author Lee
 * @date 2019/3/9
 */
public class ConcurrentMapTest {

    public static void main(String[] agrs) throws InterruptedException {
        long startDate = System.currentTimeMillis();
//        final HashMap<String,String> map = new HashMap<String,String>();
        final Map<String, String> map = new Hashtable<>();

        Thread t = new Thread(new Runnable(){
            public  void run(){

                for(int x=0;x<10000;x++){
                    Thread tt = new Thread(new Runnable(){
                        public void run(){
                            map.put(UUID.randomUUID().toString(),"");
                        }
                    });
                    tt.start();
                    System.out.println(tt.getName());
                }
            }
        });
        t.start();
        t.join();
        long endDate = System.currentTimeMillis();
        System.out.println(endDate - startDate);

    }

}
